package com.xuecheng.base.exception;

/**
 * @author cyf
 * @version 1.0
 * @description #自定义异常
 * @date 2024/8/31 15:50
 **/
public class XueChengPlusException extends RuntimeException {
    private String errCode;
    private String errMessage;


    public XueChengPlusException() {
        super();
    }

    public XueChengPlusException(String errCode, String errMessage) {
        super(errMessage);
        this.errCode = errCode;
        this.errMessage = errMessage;
    }

    public XueChengPlusException(String errMessage) {
        super(errMessage);
        this.errMessage = errMessage;
    }


    public String getErrMessage() {
        return errMessage;
    }

    public String getErrCode() {
        return errCode;
    }

    public static void cast(CommonError commonError) {
        throw new XueChengPlusException(commonError.getErrMessage());
    }

    public static void cast(String errMessage) {
        throw new XueChengPlusException(errMessage);
    }

    public static void cast(String errCode, String errMessage) {
        throw new XueChengPlusException(errCode, errMessage);
    }
}
